package springaop;


import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

//给予Spring 定义一个切面类
public class MyAspectSpring  implements MethodInterceptor {

    public void beforeInfo(){
        System.out.println("方法前执行！");
    }
    public void afterInfo(){
        System.out.println("方法后执行！");
    }

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        beforeInfo();
        Object proceed = invocation.proceed();
        afterInfo();
        return proceed;
    }
}
